package com.lostsheep.rest.impl.user;

import com.lostsheep.rest.UserRest;
import com.lostsheep.vo.UserVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <b><code>UserRestImpl</code></b>
 * <p/>
 * Description
 * <p/>
 * <b>Creation Time:</b> 2024/8/25.
 *
 * @author dengzhen
 * @since spring-cloud-dubbo
 */
@RestController
@RequestMapping("/user")
public class UserRestImpl implements UserRest {
    
    @GetMapping("/{userId}")
    @Override
    public UserVO getUser(@PathVariable("userId") String userId) {
        return UserVO.builder()
                .id(1L)
                .userName("张三")
                .address("广东省广州市天河区")
                .age(18)
                .phone(null)
                .build();
    }

    @GetMapping("/list")
    @Override
    public List<UserVO> listUsers() {
        UserVO userVO = UserVO.builder()
                .id(1L)
                .userName("张三")
                .address("广东省广州市天河区")
                .age(18)
                .phone("13800138000")
                .build();
        return List.of(userVO);
    }
}
